package com.qf.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.mapper.StudentMapper;
import com.qf.pojo.Student;
import com.qf.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentMapper studentMapper;

    @Override
    public List<Student> findAll() {
        return studentMapper.findAll();
    }

    @Override
    public PageInfo<Student> page(Integer page, Integer size) {

        PageHelper.startPage(page,size);

        List<Student> students = studentMapper.findAll();

        return new PageInfo<>(students);
    }

    @Override
    public void update(Student stu) {
        studentMapper.update(stu);
    }

    @Override
    public void add(Student stu) {
        studentMapper.add(stu);
    }

    @Override
    public void del(String number) {
        studentMapper.del(number);
    }

}
